using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace GeYiHome.PublicLibrary
{
    public class NlResult<T>
    {
        public NlResult(T data)
        {
            this.Data = data;
            this.Result = true;
        }

        public T Data { get; set; }

        public string Msg { get; set; }

        public string Code { get; set; }

        public bool Result { get; set; }
    }

    public static class NlResultExtension
    {
        public static T GetRntData<T>(this NlResult<T> result)
        {
            if (!result.Result)
                throw new Exception($"exception msg :{result.Msg},Code :{result.Code}");
            return result.Data;
        }
    }
}
